package org.jeecg.modules.bv.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.bv.entity.BvVersions;
import org.jeecg.modules.bv.mapper.BvVersionsMapper;
import org.jeecg.modules.bv.service.IBvVersionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: 票据版本号
 * @Author: jeecg-boot
 * @Date:   2022-03-09
 * @Version: V1.0
 */
@Service
public class BvVersionsServiceImpl extends ServiceImpl<BvVersionsMapper, BvVersions> implements IBvVersionsService {

    @Autowired
    private BvVersionsMapper versionsMapper;

    @Override
    public BvVersions getCurrentVersion(String billTypeId){
        return versionsMapper.selectOne(new LambdaQueryWrapper<BvVersions>()
                .eq(BvVersions::getStatus, "1")
                .eq(BvVersions::getBillTypeId, billTypeId)
                .eq(BvVersions::getDelFlag, 0));
    }
}
